package org.wolfengi.handler.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author: wolfengi
 * @Description: ${TODO}
 * @Date: Created in 19:26 2020/5/23
 * @Modified By:
 */

@AllArgsConstructor
@Getter
public enum ShipCN {

    SHIP_LINER("Liner", "邮轮"),
    SHIP_TUG("Tug", "拖轮"),
    SHIP_CONTAINER("Container", "集装箱船"),
    SHIP_CATCH("Catch", "捕捞"),
    SHIP_CARGO("Cargo", "货船"),
    SHIP_OTHER("Other", "其他"),

    STATE_UNDERWAY("underway", "在航"),
    STATE_STRANDED("stranded", "搁浅"),
    STATE_MOORING("mooring", "锚泊"),

    FAULT_FUEL("Fuel, pipeline and pump", "燃油、管路及泵"),
    FAULT_OIL("Oil, pipeline and pump", "滑油、管路及泵"),
    FAULT_KEY("Key operations", "关键性操作"),
    FAULT_DIESEL("Diesel engine exhaust temperature and cooling", "柴油机排温和冷却"),
    FAULT_STEERING("steering engine", "舵机"),
    FAULT_SUPER("Diesel supercharger", "柴油机增压器"),
    FAULT_SECURE("Diesel engine security network", "柴油机安全网"),
    FAULT_OTHER("other", "其他故障"),
    FAULT_NULL("null", "无故障"),
    NORMAL("normal", "正常"),
    FAULT("fault", "故障");

    /**
     * 英文
     */
    private String shipEN;
    /**
     * 中文
     */
    private String shipCN;

    public static String getCN(String enName) {
        ShipCN[] values = ShipCN.values();
        for (ShipCN value : values) {
            if (null != enName && value.getShipEN().equals(enName)) {
                return value.getShipCN();
            }
        }
        return null;
    }

    public static String getCNTrim(String enName) {
        ShipCN[] values = ShipCN.values();
        for (ShipCN value : values) {
            String shipen = value.getShipEN().trim();
            if (null != enName && shipen.equals(enName.trim()) || enName.contains(shipen) || shipen.contains(enName)) {
                return value.getShipCN();
            }
        }
        return null;
    }
}
